package cn.bdqn.activity02;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import javax.xml.transform.Result;

public class TwoActivity extends AppCompatActivity implements View.OnClickListener {
    private Button btnReturnTwo;
    private TextView tv_two;
    private  Intent intent;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_two);

        tv_two=findViewById(R.id.tv_two);
        btnReturnTwo=findViewById(R.id.btn_returnTwo);
        btnReturnTwo.setOnClickListener(this);
        tv_two.setText(intent.getStringExtra("msg"));

    }

    @Override
    public void onClick(View v) {
         if (v.getId()==R.id.btn_returnTwo){
            intent=getIntent();
             intent.putExtra("twomsg","恭喜你到B页面,Weclome you");
             setResult(RESULT_OK,intent);
             finish();//当前关闭，返回one
         }
    }
}
